Skip to content

fix: add explicit timeout policy for generated project test workflows - #430

Open
Halimatyemisi wants to merge 2 commits into
DigiNodes:mainfrom
Halimatyemisi:security/issue-339-sw-158-add-explicit-timeout-policy-for
Open

Halimatyemisi wants to merge 2 commits into
DigiNodes:mainfrom
Halimatyemisi:security/issue-339-sw-158-add-explicit-timeout-policy-for

Conversation

@Halimatyemisi

Copy link
Copy Markdown

Overview

This PR adds an explicit, bounded timeout policy for stellarforge test so a hung generated-project test command cannot block a developer indefinitely. It introduces a documented default timeout, a future-safe internal option boundary, bounded child-process-tree termination with a grace period, and clear timeout-vs-failure signaling in exit codes and output. The timeout is scoped to test only and does not affect dev unless explicitly configured there.

Related Issue

Changes

⏱️ Timeout Policy for Generated-Project Tests

  • [MODIFY] src/testing/project.ts

    • Adds a documented default timeout for generated-project test execution.
    • Introduces a future-safe internal option boundary so the timeout is configurable only through an approved interface (no interactive prompt).
    • Implements bounded child-process-tree termination: graceful stop first, then forced kill within a bounded grace period.
    • Emits clear messaging when a timeout occurs so legitimate long tests are not silently killed.
  • [MODIFY] src/commands/test.ts

    • Wires the timeout policy into the test command path.
    • Distinguishes timeout from test failure in exit code and output.
  • [MODIFY] docs/reference/configuration.md

    • Documents the default timeout and the approved configuration interface.
  • [MODIFY] docs/reference/exit-codes.md

    • Documents the timeout exit code and how it differs from a test-failure exit code.

🧪 Tests

  • [MODIFY] tests/test-project.test.ts

    • Covers graceful timeout cleanup behavior.
  • [MODIFY] tests/test-workflow-platform-and-exit.test.ts

    • Covers forced timeout cleanup and exit-code/output distinction on supported platforms.

Verification Results

npm test -- tests/test-project.test.ts tests/test-workflow-platform-and-exit.test.ts
✅ Timeout cleanup (graceful + forced) covered
✅ Exit code and output distinguish timeout from test failure
✅ `dev` unaffected unless explicitly configured
Acceptance Criteria Status
Default timeout is documented and configurable only through an approved interface ✅ Documented in docs/reference/configuration.md; internal option boundary in src/testing/project.ts
Timeout stops the child process tree within a bounded grace period ✅ Graceful stop then forced kill within grace period
Exit code and output clearly distinguish timeout from test failure ✅ Documented in docs/reference/exit-codes.md; covered in tests
Timeout does not affect dev unless explicitly configured there ✅ Scoped to test command path
Tests cover graceful and forced timeout cleanup on supported platforms ✅ Covered in tests/test-project.test.ts and tests/test-workflow-platform-and-exit.test.ts

Closes #339

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 187c78ce-1179-4852-ac96-9b07259b0553
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Halimatyemisi

Copy link
Copy Markdown
Author

this PR is ready for another review. I resolved the merge conflicts with the main branch (pushed 2e59384).
Files changed: docs/reference/exit-codes.md, tests/test-project.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SW-158 — Add explicit timeout policy for generated project test workflows

1 participant